lme4 model details

last modified

2024–11–27

Standard methods for "merMod" objects.

library(lme4)
Loading required package: Matrix
methods(class="merMod")
 [1] anova          as.function    coef           confint        cooks.distance
 [6] deviance       df.residual    drop1          extractAIC     family        
[11] fitted         fixef          formula        getData        getL          
[16] getME          hatvalues      influence      isGLMM         isLMM         
[21] isNLMM         isREML         logLik         model.frame    model.matrix  
[26] ngrps          nobs           plot           predict        print         
[31] profile        ranef          refit          refitML        rePCA         
[36] residuals      rstudent       show           sigma          simulate      
[41] summary        terms          update         VarCorr        vcov          
[46] weights       
see '?methods' for accessing help and source code
getME
‘ “everything a user may want” from a fitted "merMod" object as far as it is not available by methods ’
# fixed-effects model matrix
getME(model, "X")
# random-effects model matrix
getME(model, "Z")
# transpose of random-effects model matrix
getME(model, "Zt")
# list of components of the transpose of the random-effects model matrix,
# separated by individual variance component
getME(model, "Ztlist")
# list of raw model matrices associated with random effects terms
getME(model, "mmList")
# response vector
getME(model, "y")
# conditional mean of the response
getME(model, "mu")
# conditional mode of the “spherical” random effects variable
getME(model, "u")
# conditional mode of the random effects variable
getME(model, "b")
# groups pointer vector. A pointer to the beginning of each group of random
# effects corresponding to the random-effects terms, beginning with 0 and
# including a final element giving the total number of random effects
getME(model, "Gp")
# theta pointer vector. A pointer to the beginning of the theta sub-vectors
# corresponding to the random-effects terms, beginning with 0 and including a
# final element giving the number of thetas.
getME(model, "Tp")
# sparse Cholesky factor of the penalized random-effects model.
getME(model, "L")
# relative covariance factor Λ of the random effects.
getME(model, "Lambda")
# transpose Λ′ of Λ above.
getME(model, "Lambdat")
# index vector for inserting elements of θ into the nonzeros of Λ.
getME(model, "Lind")
# vector of template matrices from which the blocks of Λ are generated.
getME(model, "Tlist",)
# Scaled sparse model matrix (class `"dgCMatrix"`) for the unit, orthogonal
# random effects, U, equal to `getME(.,"Zt") %*% getME(.,"Lambdat")`
getME(model, "A")
# Cholesky factor for the fixed-effects parameters
getME(model, "RX")
# cross-term in the full Cholesky factor
getME(model, "RZX")
# residual standard error; note that `sigma(object)` is preferred.
getME(model, "sigma")
# a list of the grouping variables (factors) involved in the random effect terms
getME(model, "flist",)
# fixed-effects parameter estimates
getME(model, "fixef")
# fixed-effects parameter estimates (identical to the result of `fixef`, but without names)
getME(model, "beta")
# random-effects parameter estimates: these are parameterized as the relative
# Cholesky factors of each random effect term
getME(model, "theta")
# A list of S and T factors in the TSST' Cholesky factorization of the relative
# variance matrices of the random effects associated with each random-effects
# term. The unit lower triangular matrix, T, and the diagonal matrix, S, for
# each term are stored as a single matrix with diagonal elements from S and
# off-diagonal elements from T.
getME(model, "ST")
# number of random-effects terms
getME(model, "n_rtrms")
# number of distinct random-effects grouping factors
getME(model, "n_rfacs")
# number of rows of X
getME(model, "N")
# length of the response vector, y
getME(model, "n")
# number of columns of the fixed effects model matrix, X
getME(model, "p")
# number of columns of the random effects model matrix, Z
getME(model, "q",)
# numbers of columns of the raw model matrices, mmList
getME(model, "p_i")
# numbers of levels of the grouping factors
getME(model, "l_i")
# numbers of columns of the term-wise model matrices, ZtList
getME(model, "q_i")
# number of random effects terms
getME(model, "k")
# numbers of covariance parameters in each term
getME(model, "m_i")
# total number of covariance parameters, i.e., the same as `dims@nth` below.
getME(model, "m",)
# the “component names”, a `list`.
getME(model, "cnms")
# 0 indicates the model was fitted by maximum likelihood, any other positive
# integer indicates fitting by restricted maximum likelihood
getME(model, "REML")
# same as the result of `isREML(.)`
getME(model, "is_REML")
# a list consisting of a named numeric vector, `cmp`, and a named integer
# vector, `dims`, describing the fitted model.
getME(model, "devcomp")
# model offset
getME(model, "offset")
# lower bounds on random-effects model parameters (i.e, "theta" parameters). In
# order to constrain random effects covariance matrices to be
# semi-positive-definite, this vector is equal to 0 for elements of the theta
# vector corresponding to diagonal elements of the Cholesky factor, `-Inf`
# otherwise. `(getME(.,"lower")==0` can be used as a test to identify diagonal
# elements, as in `isSingular`.)
getME(model, "lower")
# deviance function (so far only available for LMMs)
getME(model, "devfun")
# negative binomial θ parameter, only for `glmer.nb`.
getME(model, "glmer.nb.theta")